<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>

<head>
	<base href="/">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    

    <title>菜单-编辑</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">

    <link rel="shortcut icon" href="favicon.ico"> <link href="static/templet/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="static/templet/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="static/templet/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="static/templet/css/animate.min.css" rel="stylesheet">
    <link href="static/templet/css/style.min862f.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        
        <div class="row">
            <div class="col-sm-6">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <a class="btn btn-danger " href="menu?parentId=${parentId }" target="_self">返回</a>
                    </div>
                    <div class="ibox-content">
                        <form method="post" action="menu/${action }" class="form-horizontal" target="_self">
                        	<div class="form-group">
                                <label class="col-sm-2 control-label">上级</label>

                                <div class="col-sm-10">
                                    <p class="form-control-static">
                                    <c:if test="${!empty menu }">
                                    	<input type="hidden" name="id" id="id" value="${menu.id }"/>
                                    </c:if>
                                    <input type="hidden" name="parentId" value="${parentId}" class="form-control">
                                    <c:choose>
                                    	<c:when test="${parentId !=0 }">
                                    	${pMenu.name }
                                    	</c:when>
                                    	<c:otherwise>
                                    	(无) 此项为顶级菜单
                                    	</c:otherwise>
                                    </c:choose>
                                    </p>
                                </div>
                            </div>
                        	<div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">名称</label>

                                <div class="col-sm-10">
                                    <input type="text" name="name" value="${menu.name }" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
   
                            <div class="form-group">
                                <label class="col-sm-2 control-label">链接</label>

                                <div class="col-sm-10">
                                    <input type="text" name="url" value="${menu.url }" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">序号</label>

                                <div class="col-sm-10">
                                    <input type="text" name="sort" value="${menu.sort }" class="form-control">
                                </div>
                            </div>                          
							
							<div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">图标</label>

                                <div class="col-sm-2">
                                    <div id="pic"><i class="${menu.icon }"></i></div>
                                    <input type="hidden" name="icon" value="${menu.icon }">
                                </div>
                                <div class="col-sm-2">
                                	<a href="javascript:showIcon();" class="fa fa-picture-o"></a>
                                </div>
                                
                            </div>    
							
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">状态</label>

                                <div class="col-sm-10">
                                    <div class="radio i-checks">
                                        <label>
                                            <input type="radio" <c:if test="${empty menu || menu.state == 1 }">checked="checked"</c:if> value="1" name="state"> <i></i> 启用</label>
                                        <label>
                                            <input type="radio" <c:if test="${menu.state == 0 }">checked="checked"</c:if> value="0" name="state"> <i></i> 禁用</label>
                                    </div>

                                </div>
                            </div>

                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <button class="btn btn-primary" type="submit">保存</button>
                                    <!-- <button class="btn btn-white" type="button">取消</button> -->
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    
    <script src="static/templet/js/jquery.min.js?v=2.1.4"></script>
    <script src="static/templet/js/bootstrap.min.js?v=3.3.5"></script>
    <script src="static/templet/js/content.min.js?v=1.0.0"></script>
    <script src="static/templet/js/plugins/iCheck/icheck.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
        	$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})
        	
        });
    	function showIcon(){
    		parent.layer.open({
        	    type: 2,
        	    title: '图标',
        	    shadeClose: true,
        	    shade: 0.8,
        	    area: ['80%', '90%'],
        	    content: 'menu/getIcon',
        	    success: function(layero, index){
        	    	var child = parent.layer.getChildFrame('body', index);
        	    	var $con = $(child).find('.fontawesome-icon-list')
        	    	$con.on('click','a',function(){
        	    		var $this = $(this);
        	    		$("#pic").find("i").attr("class",$this.find("i").attr("class"))
        	    		$("input[name=icon]").val($this.find("i").attr("class"));
        	    		parent.layer.close(index);
        	    	})
        	    }
        	    
        	});
    		
    	}
    </script>
</body>

</html>